package com.code.leetcode.offer;

import com.code.leetcode.utils.TreeNode;
import sun.reflect.generics.tree.Tree;

/**
 * @author codeDorado
 * @version 1.0
 * @date 2020/8/1 10:31
 */
public class The28 {
    public boolean isSymmetric(TreeNode root) {
        return dfs(root, root);
    }

    public boolean dfs(TreeNode node1, TreeNode node2) {
        if (node1 == null || node2 == null) {
            if (node1 == null && node2 == null) return true;
            else return false;
        }
        if (node1.val != node2.val) return false;
        return dfs(node1.left, node2.right) && dfs(node1.right, node2.left);
    }
}
